<?php

/**
 * Created by Sublime.
 * User: yinni
 * Date: 2017/11/29 14:05
 */
namespace App\Http\Controllers\Admin\Coring;

use Log;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Services\Admin\CoringService;
use App\Http\Requests\Admin\CoringRequest;
use \App\Http\Controllers\Admin\BaseController;

/**
 * 实时监测动态河道信息
 * Class CoringController
 * @package App\Http\Controllers\Admin\Coring
 */

class CoringController extends BaseController
{
    protected $service;

    public function __construct(CoringService $service)
    {
        parent::__construct();
        $this->service = $service;
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        // $username = $this->service->getManagerRivers();
        $result = $this->service->index();
        return request()->ajax() ? $result : view('themes.admin.coring.index')->with($result);
    }

    // Coring实时监测信息
    public function alltimeinfo() {
        $alltimeinfo = $this->service->ajaxData();
        return $alltimeinfo;
    }

    // 动态获取当前用户管理河道信息
    public function getManagerRivers() {
        $rivers_all = $this->service->getManagerRivers();
        return response()->json($rivers_all);
    }



}